<?php  
class ControllerCommonSitemap extends Controller {
	public function index() {
		$this->document->setTitle($this->config->get('config_title'));
		$this->document->setDescription($this->config->get('config_meta_description'));
		$this->language->load('common/footer');
		$this->data['heading_title'] = $this->config->get('config_title');
		
		$this->load->model('catalog/information');
		
		$this->document->setTitle('SITEMAP');
		$this->document->setDescription('sitemap');
		
		$this->load->model('catalog/category');
		$this->data['categories'] = array();
		
		$this->data['text_footer_company'] = $this->language->get('text_footer_company');
		$this->data['text_footer_more_info'] = $this->language->get('text_footer_more_info');
		$this->data['text_footer_about_us'] = $this->language->get('text_footer_about_us');
		$this->data['text_footer_contact_us'] = $this->language->get('text_footer_contact_us');
		$this->data['text_footer_warranty'] = $this->language->get('text_footer_warranty');
		$this->data['text_footer_sitemap'] = $this->language->get('text_footer_sitemap');
		$this->data['text_footer_term'] = $this->language->get('text_footer_term');
		$this->data['text_footer_faq'] = $this->language->get('text_footer_faq');
		
		
		$results = $this->model_catalog_category->getCategories(0);
		
		foreach ($results as $result) {
			$this->data['categories'][] = array(
					'category_id'  => $result['category_id'],
					'name'  => $result['name'],
					'href'  => $this->url->link('product/category', 'path=' . $this->model_catalog_category->getPath($result['category_id']) )
				);
		}
		//print_r($this->data['categories']);
		//print_r($this->model_catalog_category->getAllCategoriesHtml(59));
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/sitemap.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/sitemap.tpl';
		} else {
			$this->template = 'default/template/common/sitemap.tpl';
		}
		
		$this->children = array(
			'common/column_left',
			'common/column_right',
			'common/content_top',
			'common/content_bottom',
			'common/footer',
			'common/header'
		);
										
		$this->response->setOutput($this->render());
	}
}
?>